#include "bench.hpp"

void con_info()
{
    // 读取CPU核心数
    std::ifstream cpuinfo("/proc/cpuinfo");
    int coreCount = 0;
    std::string line;
    while (std::getline(cpuinfo, line)) {
        if (line.substr(0, 9) == "processor") {
            coreCount++;
        }
    }

    std::cout << "CPU核心数: " << coreCount << std::endl;

    // 读取可用内存大小
    std::ifstream meminfo("/proc/meminfo");
    long long memorySize = 0;
    while (std::getline(meminfo, line)) {
        if (line.substr(0, 9) == "MemTotal:") {
            memorySize = std::stoll(line.substr(10));
            break;
        }
    }

    // 将内存大小转换为GB
    double memorySizeGB = static_cast<double>(memorySize) / (1024 * 1024);
    std::cout << "可用内存大小: " << memorySizeGB << " GB" << std::endl;

}

int main()
{
    con_info();
    Log::async_test();
    return 0;
}